package cn.wx.scholar.tool.generator;

import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;

import io.swagger.annotations.ApiParam;

@RestController
public class CreateController {
	
	@RequestMapping(value = "/gener/create" ,method = RequestMethod.POST)
    public JSONObject create(
    		@ApiParam(name = "tablex") String tablex,
    		@ApiParam(name = "myHtml") Boolean myHtml
    		){
		Boolean flag = false;
		JSONObject result = new JSONObject();
		if(StringUtils.isNotBlank(tablex)){
			String[] a = tablex.split("_");
			Generator.myHtml = myHtml;
			flag = Factory.genCreate(tablex, a[0]+"_");
		}
		result.put("flag", flag);
        return result;
    }
	
}
